import { createRouter, createWebHistory } from "vue-router";
import Layout from "@/components/layout.vue";

const routes = [
  // {
  //   path: "/login",
  //   name: "login",
  //   component: () => import("@/views/login/index.vue"),
  // },
  {
    path: "/",
    component: Layout,
    redirect: "/index",
    children: [
      {
        path: "/index",
        name: "index",
        meta: { title: "首页", active: 0, titleShow: true,  },
        component: () => import("@/views/index.vue"),
      },
      {
        path: "/list",
        name: "list",
        meta: { title: "列表",  },
        component: () => import("@/views/list/index.vue"),
      },
      {
        path: "/goodOrder",
        name: "goodOrder",
        meta: { title: "商品订单", },
        component: () => import("@/views/goodOrder/index.vue"),
      },
      {
        path: "/goodHfOrder",
        name: "goodHfOrder",
        meta: { title: "商品订单", },
        component: () => import("@/views/goodHfOrder/index.vue"),
      },
      {
        path: "/goodDetail",
        name: "goodDetail",
        meta: { title: "商品详情",  },
        component: () => import("@/views/goodDetail/index.vue"),
      },
      {
        path: "/home",
        name: "home",
        meta: { title: "支付",  },
        component: () => import("@/views/home/index.vue"),
      },
      {
        path: "/payOrder",
        name: "payOrder",
        meta: { title: "支付订单",  },
        component: () => import("@/views/payOrder/index.vue"),
      }, {
        path: "/payResult",
        name: "payResult",
        meta: { title: "支付成功", titleShow: true, },
        component: () => import("@/views/payResult/index.vue"),
      }, {
        path: "/mine",
        name: "mine",
        meta: { title: "我的", active: 1, titleShow: true, keepAlive: true },
        component: () => import("@/views/mine/index.vue"),
      }
      , {
        path: "/settingMine",
        name: "settingMine",
        meta: { title: "设置", active: 1 },
        component: () => import("@/views/mine/settingMine.vue"),
      }
      , {
        path: "/anchor",
        name: "anchor",
        meta: { title: "主播", titleShow: true, },
        component: () => import("@/views/anchor/index.vue"),
      },
      {
        path: "/login",
        name: "login",
        meta: { title: "加载中", active: 0, },
        component: () => import("@/views/login/index.vue"),
      },
      {
        path: "/register",
        name: "register",
        meta: { title: "登录/注册", active: 0, },
        component: () => import("@/views/register/index.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
